open Castling;;

module PG = ParserGenerator (
	struct
		type t = Token.t;;
		let eof = CharToken.eof;;
		let invalid = CharToken.invalid;;
		let compare = CharToken.compare;;
		let pp_pattern = CharToken.pp_pattern;;
		let pp = CharToken.pp;;
		let pp_typename ~(quali: bool) ~(paren: bool) (f: Format.formatter) (_: t list): unit = (
			if quali then Format.pp_print_string f "Token.";
			Format.pp_print_string f "t"
		);;
	end);;
open PG;;

runtime_debug := true;;
pretty_printer := true;;
error_printer := true;;
ranged_position := true;;
generate ~ast_module:"AST" ~parser_module:"Parser" (
	one_of ~name:"variant" ["x", element 'x' >> element '1'; "y", position_with (element 'y'); error "z", element 'z']
);;
